package com.example.demo.code;

import lombok.Getter;

@Getter
public enum CustomStatusCode {
    // 成功响应码
    SUCCESS(0, "成功"),
    OPERATION_SUCCESSFUL(100, "操作成功"),
    AUTHORIZATION_SUCCESS(101, "授权成功"),
    LOGIN_SUCCESS(102, "登录成功"),
    LOGOUT_SUCCESS(103, "登出成功"),
    REGISTRATION_SUCCESS(104, "注册成功"),
    RESOURCE_CREATED(105, "资源创建成功"),
    RESOURCE_UPDATED(106, "资源更新成功"),
    RESOURCE_DELETED(107, "资源删除成功"),
    RESOURCE_QUERY(108, "资源查询成功"),
    RESOURCE_QUERY_ALL(109, "所有资源查询成功"),


    // 业务逻辑错误
    BUSINESS_ERROR(-10000, "业务逻辑错误"),
    INVALID_REQUEST(-10001, "无效请求"),
    AUTHENTICATION_FAILED(-10002, "认证失败"),
    ACCESS_DENIED(-10003, "权限不足"),
    RESOURCE_NOT_FOUND(-10004, "资源未找到"),
    DUPLICATE_RESOURCE(-10005, "资源重复"),
    INVALID_METHOD(-10006, "无效的方法"),
    LOGIN_FAILED(-10007, "登录失败，用户名或密码错误"),

    // 数据库操作错误
    DATABASE_ERROR(-20000, "数据库操作错误"),
    QUERY_ERROR(-20001, "查询错误"),
    INSERTION_ERROR(-20002, "插入错误"),
    UPDATE_ERROR(-20003, "更新错误"),
    DELETION_ERROR(-20004, "删除错误"),
    CONSTRAINT_VIOLATION(-20005, "约束违反"),
    DATABASE_CONNECTION_ERROR(-20006, "数据库连接错误"),

    // 服务器内部错误
    INTERNAL_ERROR(-30000, "服务器内部错误"),
    SYSTEM_FAILURE(-30001, "系统故障"),
    CONFIGURATION_ERROR(-30002, "配置错误"),
    UNKNOWN_ERROR(-30003, "未知错误"),
    TIMEOUT_ERROR(-30004, "超时错误"),
    UNEXPECTED_EXCEPTION(-30005, "意外异常"),
    ACCOUNT_DISABLED(-30006, "账户已被禁用"),
    ACCOUNT_LOCKED(-30007, "账户已被锁定"),
    CREDENTIALS_EXPIRED(-30008, "凭证已过期"),
    ACCOUNT_EXPIRED(-30009, "账户已过期"),
    PASSWORD_EXPIRED(-30010, "密码已过期"),
    INVALID_CREDENTIALS(-30011, "凭证无效"),
    UNAUTHORIZED(-30012, "未授权");

    private final int code;
    private final String description;

    CustomStatusCode(int code, String description) {
        this.code = code;
        this.description = description;
    }

}
